//
//  ClassTableVC.m
//  XTeng
//
//  Created by 周成龙 on 16/8/12.
//  Copyright © 2016年 ZCL. All rights reserved.
//

#import "ClassTableVC.h"

#import "VDJConstant.h"
#import "TabBarVC.h"
#import "ClassTabBaeVC.h"

#import "NoticeHeader.h"

#import "LRButton.h"
#import "WeekView.h"
#import "ClassTableLine.h"


#import "ClassListVC.h"

@interface ClassTableVC ()<WeekViewDelegate>
{
    LRButton *_centerButton;
}

@property (nonatomic ,strong)UIScrollView *bgScroView;

@end

@implementation ClassTableVC

- (UIScrollView *)bgScroView
{
    if (_bgScroView == nil) {
        CGRect frame = CGRectMake(0, [self getStartOriginY], kScreenWidth, kScreenHeight - [self getStartOriginY] - 49);
        _bgScroView = [[UIScrollView alloc] initWithFrame:frame];
        _bgScroView.showsVerticalScrollIndicator = NO;
        _bgScroView.showsHorizontalScrollIndicator = NO;
        _bgScroView.backgroundColor = kRedFontColor;
    }
    return _bgScroView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor purpleColor];
    [self initLeftButton];
    [self initCenterView];
    
    [self initContentView];
}

- (void)initContentView
{
    WeekView *view = [[WeekView alloc] initWithFrame:CGRectMake(40, [self getStartOriginY], kScreenWidth - 40, 44)];
    view.backgroundColor = kRedFontColor;
    view.delegate = self;
    [self.view addSubview:view];
    
}

- (void)initLeftButton
{
    UIButton *left = [[UIButton alloc] init];
    left.bounds = CGRectMake(0, 0, 60, 20);
    left.center = CGPointMake(kMargin + 30, self.navBarView.center.y + 10);
    [left setTitle:@"考试" forState:UIControlStateNormal];
    left.titleLabel.font = kFontWithSize(14);
    [left setTitleColor:kWhiteColor forState:UIControlStateNormal];
    [left addTarget:self action:@selector(leftuttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.navBarView addSubview:left];
}

- (void)initCenterView
{
    if (_centerButton == nil) {
        _centerButton = [[LRButton alloc] init];
        _centerButton.bounds = CGRectMake(0, 0, 90, 20);
        _centerButton.center = CGPointMake(self.navBarView.center.x, self.navBarView.center.y + 10);
        _centerButton.style = LRButtonStyleRTextLImage;
        _centerButton.imageWidth = 10;
        _centerButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
        _centerButton.titleLabel.textAlignment = NSTextAlignmentCenter;
        _centerButton.titleLabel.font = kFontWithSize(15);
        _centerButton.backgroundColor = kClearClolor;
        [_centerButton setTitle:@"第23周" forState:UIControlStateNormal];
        [_centerButton setImage:[UIImage imageNamed:@"下拉"] forState:UIControlStateNormal];
//        [_centerButton setImage:[UIImage imageNamed:@"个人中心_13"] forState:UIControlStateSelected];
        [_centerButton addTarget:self action:@selector(centerButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        [self.navBarView addSubview:_centerButton];
    }
}

- (void)leftuttonClick:(UIButton *)sender
{
//    sender.selected = !sender.selected;
//    [[NSNotificationCenter defaultCenter] postNotificationName:kChangeTabBar object:@{@"value":@"isTest"}];
    
    ClassListVC *vc = [[ClassListVC alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)centerButtonClick:(UIButton *)sender
{
    sender.selected = !sender.selected;
    NSLog(@"centerButtonClick");
    
    
}

#pragma  mark - delegate
- (void)didWeekItem:(UIButton *)button
{
    NSLog(@"星期----");
}

@end
